CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
ENABLE_LANGUAGE(ASM)

MESSAGE("Compile the freertos")
MESSAGE("Current dir is ${CMAKE_CURRENT_SOURCE_DIR}")

MESSAGE(STATUS "----------------------------------------")
MESSAGE(STATUS "C FLAGS:${CMAKE_C_FLAGS}")
MESSAGE(STATUS "CXX FLAGS:${CMAKE_CXX_FLAGS}")
MESSAGE(STATUS "ASM FLAGS:${CMAKE_ASM_FLAGS}")
MESSAGE(STATUS "LINK FLAGS:${CMAKE_EXE_LINKER_FLAGS}")
MESSAGE(STATUS "----------------------------------------")

# source files
SET(LOCAL_SOURCE_FILES)
FILE(GLOB U_TMP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/os/*.c")
LIST(APPEND LOCAL_SOURCE_FILES ${U_TMP_FILES})
LIST(APPEND LOCAL_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/os/portable/GCC/ARM_CM3/port.c")
LIST(APPEND LOCAL_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/os/portable/MemMang/heap_4.c")

# header files
SET(LOCAL_SOURCE_HEADER)
LIST(APPEND LOCAL_SOURCE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/os/include")
LIST(APPEND LOCAL_SOURCE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/os/portable/GCC/ARM_CM3")
#LIST(APPEND LOCAL_SOURCE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/osal")
LIST(APPEND LOCAL_SOURCE_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/config")
INCLUDE_DIRECTORIES(${LOCAL_SOURCE_HEADER} ${U_CURRENT_HEAD_DIR})

#definitions
#ADD_DEFINITIONS("-D__CORTEX_M3")



ADD_LIBRARY("freertos" STATIC ${LOCAL_SOURCE_FILES})

